﻿using System;
using System.Windows.Media;
using System.Collections.Generic;

namespace SurveySystem.Model
{
    /// <summary>
    /// Represents a single survey in the system. This class defines a survey, and contains fields pertaining to properties of the 
    /// survey, and also a list of <see cref="Question"/> objects which define the questions. Survey results are represented by the
    /// <see cref="Response"/> and <see cref="ResponseAnswer"/> classes.
    /// </summary>
    public class Survey
    {
        /// <summary>
        /// ID field of this Survey object
        /// </summary>
        public int SurveyID { get; set; }
        /// <summary>
        /// Title of survey
        /// </summary>
        public string Title { get; set; }
        /// <summary>
        /// Longer description of survey
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// URL pointing survey-taker to more information about the survey (contact details, background, results, etc)
        /// </summary>
        public string MoreInfoUrl { get; set; }
        /// <summary>
        /// Field containing owner information (person, group, project, etc)
        /// </summary>
        public string Owner { get; set; }
        /// <summary>
        /// The date the survey was created in the system (NOT a future date when the survey will be available)
        /// </summary>
        public DateTime OpenDate { get; set; }
        /// <summary>
        /// The date the survey will close automatically
        /// </summary>
        public DateTime CloseDate { get; set; }
        /// <summary>
        /// Indicates that this survey has no CloseDate (needed because C# cannot represent a null DateTime object)
        /// </summary>
        public bool NoCloseDate { get; set; }
        /// <summary>
        /// Whether the survey has been closed manually or not
        /// </summary>
        public bool Closed { get; set; }
        /// <summary>
        /// List of <see cref="Question"/> objects pertaining to this survey
        /// </summary>
        public List<Question> Questions { get; private set; }

        /// <summary>
        /// The foreground colour for the survey, questions can override this with <see cref="Question.ForegroundColor"/>.
        /// </summary>
        public Color ForegroundColor { get; set; }
        
        /// <summary>
        /// The background colour for the survey, questions can override this with <see cref="Question.BackgroundColor"/>.
        /// </summary>
        public Color BackgroundColor { get; set; }

        public Survey()
        {
            SurveyID = -1;
            Title = "";
            Description = "";
            MoreInfoUrl = "";
            Owner = "";
            NoCloseDate = true;
            Closed = false;
            BackgroundColor = Colors.Black;
            ForegroundColor = Colors.White;
            Questions = new List<Question>();
        }
    }
}
